import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import toBackUp from '@/components/toBackUp'

/// //
import BaseRouter from './base.js'
/// //
import layout from '@/views/layout'

Vue.use(Router)

export const AsyncRouters = [ BaseRouter ]

export default new Router({
	routes: [
		{
			path: '/',
			name: 'HelloWorld',
			component: HelloWorld
		},
		{
			path: '/toBackUp',
			name: 'toBackUp',
			component: toBackUp
		},
		{
			path: '/base/paper',
			component: () => import('@/views/base/paper'),
			name: 'BaseStaffLink'
		},
		{
			// 试题/base/paper-item' + '/initEditPage
			path: '/base/paper-item/initEditPage',
			component: () => import('@/views/base/paperItem/edit'),
			name: 'BaseStaffLink',
			meta: { title: 'base.staff', roles: [ 'base:staff' ] }
		},
		{
			// 人物
			path: '/base/user',
			component: () => import('@/views/base/user'),
			name: 'BaseUser',
			meta: { title: 'base.staff', roles: [ 'base:staff' ] }
		},
		{
			// 人物，编辑
			path: '/base/user/edit',
			component: () => import('@/views/base/user/edit'),
			name: 'BaseUserEdit',
			meta: { title: 'base.staff', roles: [ 'base:staff' ] }
		},
		{
			// 路由；代码生成
			path: '/codedesign',
			component: () => import('@/views/codedesign'),
			name: 'BaseStaffLink',
			meta: { title: 'base.staff', roles: [ 'base:staff' ] }
		},
		{
			path: '/base/paper/item',
			component: () => import('@/views/base/paper/item'),
			name: 'BasePaperItemLink',
			meta: { title: 'base.paper.item', roles: [ 'base:paper:item' ] }
		},
		{
			path: '/base/paper/item/edit',
			component: () => import('@/views/base/paper/item/edit'),
			hidden: true,
			name: 'BasePaperItemEditLink',
			meta: { title: 'base.paper.itemEdit', roles: [ 'base:paper:item:edit' ], noCache: true }
		},
		{
			path: '/base/paper/item/detail',
			component: () => import('@/views/base/paper/item/detail'),
			hidden: true,
			name: 'BasePaperItemDetailLink',
			meta: { title: 'base.paper.itemDetail', noCache: true }
		},
		// {
		// 	path: '/base/user',
		// 	component: layout,
		// 	name: 'BaseUserInfoLink',
		// 	meta: { title: 'base.user.info', roles: [ 'base:user:info' ] },
		// 	children: [
		// 		{
		// 			path: 'info',
		// 			component: () => import('@/views/base/user/info'),
		// 			name: 'BaseUserInfoLink',
		// 			meta: { title: 'base.user.info', roles: [ 'base:user:info' ] }
		// 		}
		// 	]
		// },
		{
			path: '/base/user/info',
			component: () => import('@/views/base/user/info'),
			hidden: true,
			name: 'BaseUserInfoLink',
			meta: { title: 'base.user.info', roles: [ 'base:user:info' ] }
		},
		{
			path: '/base/user/info/edit',
			component: () => import('@/views/base/user/info/edit'),
			hidden: true,
			name: 'BaseUserInfoEditLink',
			meta: { title: 'base.user.infoEdit', roles: [ 'base:user:info:edit' ], noCache: true }
		},
		{
			path: '/base/user/info/detail',
			component: () => import('@/views/base/user/info/detail'),
			hidden: true,
			name: 'BaseUserInfoDetailLink',
			meta: { title: 'base.user.infoDetail', noCache: true }
		},
		{
			path: '/base/company/info',
			component: () => import('@/views/base/company/info'),
			name: 'BaseCompanyInfoLink',
			meta: { title: 'base.company.info', roles: [ 'base:company:info' ] }
		},
		{
			path: '/base/company/info/edit',
			component: () => import('@/views/base/company/info/edit'),
			hidden: true,
			name: 'BaseCompanyInfoEditLink',
			meta: { title: 'base.company.infoEdit', roles: [ 'base:company:info:edit' ], noCache: true }
		},
		{
			path: '/base/company/info/detail',
			component: () => import('@/views/base/company/info/detail'),
			hidden: true,
			name: 'BaseCompanyInfoDetailLink',
			meta: { title: 'base.company.infoDetail', noCache: true }
		}
	]
})
